﻿<Page
    x:Class="RockHopper.TrainingCalculator.WinRT.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ctrl="using:RockHopper.TrainingCalculator.WinRT.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <ctrl:TileLayoutControl 
        Background="{StaticResource BackgroundBrush}">

        <ctrl:TileControl
            ctrl:TileLayoutControl.LandscapeRow="1"
            ctrl:TileLayoutControl.LandscapeColumn="1"
            ctrl:TileLayoutControl.PortraitRow="1"
            ctrl:TileLayoutControl.PortraitColumn="1"
            ctrl:TileLayoutControl.RowSpan="4"
            ctrl:TileLayoutControl.ColumnSpan="4"
            Style="{StaticResource LargeTileStyle}"
            Background="{StaticResource GreenTileBrush}"
            DataContext="{Binding VdotTile}"
            LogoImageKey="VdotImage"
            Label="{Binding Label}"
            LiveTileInfo="{Binding LiveTileInfo}"
            LiveTileInfoFontSize="60"
            EnableLiveTile="true"
            TileCommand="{Binding PopupCommand}"/>
        <ctrl:TileControl 
            ctrl:TileLayoutControl.LandscapeRow="1"
            ctrl:TileLayoutControl.LandscapeColumn="5"
            ctrl:TileLayoutControl.PortraitRow="5"
            ctrl:TileLayoutControl.PortraitColumn="1"
            ctrl:TileLayoutControl.ColumnSpan="2"
            ctrl:TileLayoutControl.RowSpan="2"
            Style="{StaticResource MediumTileStyle}"
            Background="{StaticResource RedTileBrush}"
            DataContext="{Binding EasyTile}"
            LogoImageKey="EasyImage"
            Label="{Binding Label, Mode=OneTime}"
            LiveTileInfo="{Binding LiveTileInfo}"
            EnableLiveTile="true"
            TileCommand="{Binding PopupCommand}"/>
        <ctrl:TileControl 
            ctrl:TileLayoutControl.LandscapeRow="1"
            ctrl:TileLayoutControl.LandscapeColumn="7"
            ctrl:TileLayoutControl.PortraitRow="5"
            ctrl:TileLayoutControl.PortraitColumn="3"
            ctrl:TileLayoutControl.ColumnSpan="2"
            ctrl:TileLayoutControl.RowSpan="2"
            Style="{StaticResource MediumTileStyle}"
            Background="{StaticResource BlueTileBrush}"
            DataContext="{Binding ThresholdTile}"
            LogoImageKey="ThresholdImage"
            Label="{Binding Label, Mode=OneTime}"
            LiveTileInfo="{Binding LiveTileInfo}"
            EnableLiveTile="true"
            TileCommand="{Binding PopupCommand}"/>
        <ctrl:TileControl 
            ctrl:TileLayoutControl.LandscapeRow="3"
            ctrl:TileLayoutControl.LandscapeColumn="5"
            ctrl:TileLayoutControl.PortraitRow="7"
            ctrl:TileLayoutControl.PortraitColumn="1"
            ctrl:TileLayoutControl.ColumnSpan="2"
            ctrl:TileLayoutControl.RowSpan="2"
            Style="{StaticResource MediumTileStyle}"
            Background="{StaticResource PurpleTileBrush}"
            DataContext="{Binding IntervalTile}"
            LogoImageKey="IntervalImage"
            Label="{Binding Label, Mode=OneTime}"
            LiveTileInfo="{Binding LiveTileInfo}"
            EnableLiveTile="true"
            TileCommand="{Binding PopupCommand}"/>
        <ctrl:TileControl 
            ctrl:TileLayoutControl.LandscapeRow="3"
            ctrl:TileLayoutControl.LandscapeColumn="7"
            ctrl:TileLayoutControl.PortraitRow="7"
            ctrl:TileLayoutControl.PortraitColumn="3"
            ctrl:TileLayoutControl.ColumnSpan="2"
            ctrl:TileLayoutControl.RowSpan="2"
            Style="{StaticResource MediumTileStyle}"
            Background="{StaticResource OrangeTileBrush}"
            DataContext="{Binding RepetitionTile}"
            LogoImageKey="RepetitionImage"
            Label="{Binding Label, Mode=OneTime}"
            LiveTileInfo="{Binding LiveTileInfo}"
            EnableLiveTile="true"
            TileCommand="{Binding PopupCommand}"/>
        <ctrl:TileControl 
            ctrl:TileLayoutControl.LandscapeRow="1"
            ctrl:TileLayoutControl.LandscapeColumn="9"
            ctrl:TileLayoutControl.PortraitRow="9"
            ctrl:TileLayoutControl.PortraitColumn="1"
            ctrl:TileLayoutControl.ColumnSpan="2"
            ctrl:TileLayoutControl.RowSpan="2"
            Style="{StaticResource MediumTileStyle}"
            Background="{StaticResource GreenTileBrush}"
            DataContext="{Binding MarathonTile}"
            LogoImageKey="MarathonImage"
            Label="{Binding Label, Mode=OneTime}"
            LiveTileInfo="{Binding LiveTileInfo}"
            EnableLiveTile="true"
            TileCommand="{Binding PopupCommand}"/>
        <ctrl:TileControl 
            ctrl:TileLayoutControl.LandscapeRow="3"
            ctrl:TileLayoutControl.LandscapeColumn="9"
            ctrl:TileLayoutControl.PortraitRow="9"
            ctrl:TileLayoutControl.PortraitColumn="3"
            Style="{StaticResource SmallTileStyle}"
            Background="{StaticResource PurpleTileBrush}"
            DataContext="{Binding RacePredictorTile}"
            LogoImageKey="RacePredictorImage"
            Label="{Binding Label, Mode=OneTime}"
            TileCommand="{Binding PopupCommand}"/>
        <ctrl:TileControl 
            ctrl:TileLayoutControl.LandscapeRow="3"
            ctrl:TileLayoutControl.LandscapeColumn="10"
            ctrl:TileLayoutControl.PortraitRow="9"
            ctrl:TileLayoutControl.PortraitColumn="4"
            Style="{StaticResource SmallTileStyle}"
            Background="{StaticResource BlueTileBrush}"
            DataContext="{Binding WindEffectTile}"
            LogoImageKey="WindEffectImage"
            Label="{Binding Label, Mode=OneTime}"
            TileCommand="{Binding PopupCommand}"/>
        <ctrl:TileControl 
            ctrl:TileLayoutControl.LandscapeRow="4"
            ctrl:TileLayoutControl.LandscapeColumn="9"
            ctrl:TileLayoutControl.PortraitRow="10"
            ctrl:TileLayoutControl.PortraitColumn="3"
            Style="{StaticResource SmallTileStyle}"
            Background="{StaticResource RedTileBrush}"
            DataContext="{Binding TempEffectTile}"
            LogoImageKey="TempEffectImage"
            Label="{Binding Label, Mode=OneTime}"
            TileCommand="{Binding PopupCommand}"/>
        <ctrl:TileControl 
            ctrl:TileLayoutControl.LandscapeRow="4"
            ctrl:TileLayoutControl.LandscapeColumn="10"
            ctrl:TileLayoutControl.PortraitRow="10"
            ctrl:TileLayoutControl.PortraitColumn="4"
            Style="{StaticResource SmallTileStyle}"
            Background="{StaticResource OrangeTileBrush}"
            DataContext="{Binding HeartRateTile}"
            LogoImageKey="HeartRateImage"
            Label="{Binding Label, Mode=OneTime}"
            TileCommand="{Binding PopupCommand}"/>

        <ctrl:PopupControl
            Title="{Binding VdotTile.Label, Mode=OneTime}"
            IsOpen="{Binding VdotTile.IsOpen}"
            CloseCommand="{Binding VdotTile.CloseCommand}">
            <ctrl:VdotPopupControl/>
        </ctrl:PopupControl>
        
        <ctrl:PopupControl
            Title="{Binding EasyTile.Label, Mode=OneTime}"
            IsOpen="{Binding EasyTile.IsOpen}"
            CloseCommand="{Binding EasyTile.CloseCommand}">
            <ctrl:InfoControl InfoKey="EasyInfo"/>
        </ctrl:PopupControl>

        <ctrl:PopupControl
            Title="{Binding MarathonTile.Label, Mode=OneTime}"
            IsOpen="{Binding MarathonTile.IsOpen}"
            CloseCommand="{Binding MarathonTile.CloseCommand}">
            <ctrl:InfoControl InfoKey="MarathonInfo"/>
        </ctrl:PopupControl>

        <ctrl:PopupControl
            Title="{Binding ThresholdTile.Label, Mode=OneTime}"
            IsOpen="{Binding ThresholdTile.IsOpen}"
            CloseCommand="{Binding ThresholdTile.CloseCommand}">
            <ctrl:ThresholdControl/>
        </ctrl:PopupControl>

        <ctrl:PopupControl
            Title="{Binding IntervalTile.Label, Mode=OneTime}"
            IsOpen="{Binding IntervalTile.IsOpen}"
            CloseCommand="{Binding IntervalTile.CloseCommand}">
            <ctrl:InfoControl InfoKey="IntervalInfo"/>
        </ctrl:PopupControl>

        <ctrl:PopupControl
            Title="{Binding RepetitionTile.Label, Mode=OneTime}"
            IsOpen="{Binding RepetitionTile.IsOpen}"
            CloseCommand="{Binding RepetitionTile.CloseCommand}">
            <ctrl:InfoControl InfoKey="RepetitionInfo"/>
        </ctrl:PopupControl>

        <ctrl:PopupControl
            Title="{Binding RacePredictorTile.Label, Mode=OneTime}"
            IsOpen="{Binding RacePredictorTile.IsOpen}"
            CloseCommand="{Binding RacePredictorTile.CloseCommand}">
            <ctrl:RacePredictorControl/>
        </ctrl:PopupControl>

        <ctrl:PopupControl
            Title="{Binding HeartRateTile.Label, Mode=OneTime}"
            IsOpen="{Binding HeartRateTile.IsOpen}"
            CloseCommand="{Binding HeartRateTile.CloseCommand}">
            <ctrl:HeartRateControl/>
        </ctrl:PopupControl>

        <ctrl:PopupControl
            Title="{Binding General.Label, Mode=OneTime}"
            IsOpen="{Binding General.IsOpen}"
            CloseCommand="{Binding General.CloseCommand}">
            <ctrl:InfoControl InfoKey="GeneralInfo"/>
        </ctrl:PopupControl>

        <ctrl:PopupControl
            Title="{Binding WindEffectTile.Label, Mode=OneTime}"
            IsOpen="{Binding WindEffectTile.IsOpen}"
            CloseCommand="{Binding WindEffectTile.CloseCommand}">
            <ctrl:InfoControl InfoKey="WindEffectInfo"/>
        </ctrl:PopupControl>

        <ctrl:PopupControl
            Title="{Binding TempEffectTile.Label, Mode=OneTime}"
            IsOpen="{Binding TempEffectTile.IsOpen}"
            CloseCommand="{Binding TempEffectTile.CloseCommand}">
            <ctrl:InfoControl InfoKey="TempEffectInfo"/>
        </ctrl:PopupControl>

    </ctrl:TileLayoutControl>

    <Page.TopAppBar>
        <AppBar Padding="10,0,10,0">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="200"/>
                    <ColumnDefinition Width="200"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Button 
                    Grid.Column="0"
                    DataContext="{Binding Units}"
                    Content="Show pace in Min/km"
                    Command="{Binding KilometresCommand}"
                    Padding="5"/>
                <Button 
                    Grid.Column="1"
                    DataContext="{Binding Units}"
                    Content="Show pace in Min/mile" 
                    Command="{Binding MilesCommand}"
                    Padding="5"/>
                <Button 
                    Grid.Column="2"
                    DataContext="{Binding General}"
                    Command="{Binding PopupCommand}"
                    Style="{StaticResource AppBarButtonStyle}"
                    Content="!"
                    FontWeight="Bold"
                    HorizontalAlignment="Right">
                </Button>
            </Grid>
           
        </AppBar>
    </Page.TopAppBar>

</Page>
